<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>单位</title>
  <style>
      body {
          font-size: 15px;
      }
    .box1 {
        width: 300px;
        height: 300px;
        background-color: #bfa;
        font-size: 20px;
    }

    .box2 {
        /*width: 100px;*/
        width: 5em;
        /*height: 50%;*/
        height: 5rem;
        background-color: pink;
    }
  </style>
</head>
<body>
<!-- px 像素 % 百分比 em 1em=1字体像素大小 rem 1rem=1根元素字体像素大小-->
<div class="box1">
  <div class="box2">box2</div>
</div>
</body>
</html>